%% Start up
h=COM_OpenNXT();
COM_SetDefaultNXT(h);

%% Do your stuff

myMotor             = NXTMotor();   % create class
myMotor.Port        = MOTOR_A;  % same as  myMotors.Port = 'BC';
myMotor.Power       = -70;       % power range from -100 to 100  (pos turn left, negative turn right)
myMotor.TachoLimit  = 1;     % the number of degree of rotation  0 up to 9999 
myMotor.SmoothStart = true;	% motor startup setting
myMotor.ActionAtTachoLimit = 'HoldBrake';   %prevent the motor from moving during stop
myMotor.SpeedRegulation = false;  % no regulation on speed

myMotor1             = NXTMotor();   % create class
myMotor1.Port        = MOTOR_B;  % same as  myMotors.Port = 'BC';
myMotor1.Power       = -60;       % power range from -100 to 100   (pos up.   neg down)
myMotor1.TachoLimit  = 20;     % the number of degree of rotation  0 up to 9999 
myMotor1.SmoothStart = true;	% motor startup setting
myMotor1.ActionAtTachoLimit = 'HoldBrake';   %prevent the motor from moving during stop
myMotor1.SpeedRegulation = false;  % no regulation on speed

myMotor2             = NXTMotor();   % create class
myMotor2.Port        = MOTOR_C;  % same as  myMotors.Port = 'BC';
myMotor2.Power       = 80;       % power range from -100 to 100     (pos down.   neg up)
myMotor2.TachoLimit  = 1;     % the number of degree of rotation  0 up to 9999 
myMotor2.SmoothStart = true;	% motor startup setting
myMotor2.ActionAtTachoLimit = 'HoldBrake';   %prevent the motor from moving during stop
myMotor2.SpeedRegulation = false;  % no regulation on speed


%path definition
path = [ 1 0 1; 1 0 0; 0 0 0; 0 2 0; 1 2 0;
1 2 1; 0 1 1; 0 1 0; 1 1 0; 1 1 1];




%while 1


%myMotor.Stop('off');
myMotor.ResetPosition();
myMotor.SendToNXT();
myMotor.WaitFor();

myMotor1.Stop('off');
myMotor1.ResetPosition();
myMotor1.SendToNXT();
myMotor1.WaitFor();

myMotor2.Stop('off');
myMotor2.ResetPosition();
myMotor2.SendToNXT();
myMotor2.WaitFor();










%end



    

    
  




%% end of connection
COM_CloseNXT(COM_GetDefaultNXT());